Skip to content

Sorting by sub-aggregation is broken in terms agg #4643

Closed
@uboness

Description

@uboness

Terms aggregations enables sorting by sub metric aggregation, a la:

{
    "aggregations": {
        "host": {
            "terms": {
                "field": "host",
                "order": {
                    "cpu_avg": "asc"
                }
            },
            "aggs": {
                "cpu_avg": {
                    "avg": {
                        "field": "cpu"
                    }
                }
            }
        }
    }
}

unfortunately, that got broken along the way.

The fix will be mostly based on #4472

thx @alexbrasetvik

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions